const userInfo = {
	namespaced: true,
	state: {
		userInfo: uni.getStorageSync('userInfo') || {},
		openid: uni.getStorageSync("openid") || '',
	},
	mutations: {
		setOpenid(state, obj) {
			state.openid = obj
			uni.setStorageSync('openid', obj);
		},
		delOpenid(state) {
			state.openid = ''
			uni.clearStorageSync('openid');
		},
		setUserInfo(state, obj) {
			state.userInfo = obj
			uni.setStorageSync('userInfo', obj);
		},
		delUserInfo(state) {
			state.userInfo = {}
			uni.clearStorageSync('userInfo');
		},
		setRoomInfo(state, obj) {
			state.userInfo = {
				...state.userInfo,
				...obj
			}
			console.log(state, '888');
		}
	},
	actions: {

	},
	getters: {
		access_token(state) {
			return state.userInfo.access_token
		}
	}
}

export default userInfo